import React, { Component } from "react";
import "./04-组件的样式.css";

export default class App extends Component {
  state = {
    isShow: true,
  };
  static propTypes = {};
  render() {
    const nowClass = this.state.isShow ? "" : "hide";
    return (
      <div>
        {this.state.isShow && <span>用户1</span>}
        <span className={nowClass}>用户1</span>
        <button onClick={() => this.setState({ isShow: !this.state.isShow })}>
          更改显示状态
        </button>
      </div>
    );
  }
}
